Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Handling Gestalt Selectors

To support calls to the public function QAEngineGestalt , your drawing engine must define a TQAEngineGestalt method. This method returns information about the capabilities of your drawing engine. For example, suppose that your drawing engine supports texture mapping and accelerates both Gouraud shading and line drawing. Suppose further that you have been assigned a vendor ID of 5, and that the engine ID of your engine is 1001. In that case, you could define a method like the one shown in Listing 13 .

Listing 13 A TQAEngineGestalt method

TQAError MyEngineGestalt (TQAGestaltSelector selector, void *response)
{
    const static char       *myEngineName = "SurfDraw 3D";

    switch (selector) {
        case kQAGestalt_OptionalFeatures:
            *((unsigned long *) response) = kQAOptional_Texture;
            break;
        case kQAGestalt_FastFeatures:
            *((unsigned long *) response) = kQAFast_Line | kQAFast_Gouraud;
            break;
        case kQAGestalt_VendorID:
            *((long *) response) = 5;
            break;
        case kQAGestalt_EngineID:
            *((long *) response) = 1001;
            break;
        case kQAGestalt_Revision:
            *((long *) response) = 0;
            break;
        case kQAGestalt_ASCIINameLength:
            *((long *) response) = strlen(myEngineName);
            break;
        case kQAGestalt_ASCIIName:
            strcpy(response, myEngineName);
            break;
        default:                        /*must flag unrecognized selectors*/
            return (kQAParamErr);
    }
    return (kQANoErr);
}

If two different drawing engines should return identical vendor and engine IDs, QuickDraw 3D RAVE chooses the one that returns the most recent revision number (that is, the value returned for the kQAGestalt_Revision selector). The larger number is considered newer.

You register your TQAEngineGestalt method with QuickDraw 3D RAVE using the TQAEngineGetMethod method, described in the next section.


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |